package com.hong.springboot.controller;


import com.alibaba.nacos.api.config.annotation.NacosValue;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Auther: csh
 * @Date: 2020/8/18 17:36
 * @Description:获取配置
 */
@Controller
@RequestMapping("/")
@Slf4j
public class IndexController {

    @NacosValue(value = "${test}", autoRefreshed = true)
    private String hong;


    @RequestMapping
    public String index() {
        log.info("首页");
        return "index";
    }

    @ResponseBody
    @GetMapping("getConfig")
    public String getConfig() {
        log.info("获取配置的值：{}",hong);
        return hong;
    }

}
